<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

header("content-type:text/html;charset=utf-8");
//引入分页类
require_once ('page.class.php');

$link=  mysql_connect('localhost', 'admin', 'admin');
mysql_select_db('user_table', $link);
mysql_query('set names utf8');

$sql="select count(*) as count from user_table";
$qry=mysql_query($sql);
$result= mysql_fetch_assoc($qry);
echo $qry,"<br>";
$count = $result['count'];
$per=8;

//实例化分页类对象
$page=new Page($count,$per);

//重新拼装SQL语句
$sqla="select * from user_table $page->limit";
$qrya=mysql_query($sqla);

while($resulta= mysql_fetch_assoc($qrya)){
 echo $resulta['user_name'] ,"----",  $resulta['nick_name'],"<br />";
    
}
echo $page->fpage(array(3,4,5,6,7));